import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

import layout from '@/layout/index'

const routes = [
  {
    path: "/",
    hidden: true,
    redirect: '/login',
    meta: {
      title: '主页'
    }
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login"),
    hidden: true,
    meta: {
      title: '登录'
    }
  },
  {
    path: "/index",
    name: "home",
    component: layout,
    redirect: '/console',
    meta: {
      title: '首页管理', icon: 'icon-dongtai'
    },
    children: [
      {
        path: "/console",
        name: "console",
        component: () => import("@/views/console"),
        meta: {
          title: '首页管理'
        }
      },
      {
        path: "/user",
        name: "user",
        component: () => import("@/views/user/index"),
        meta: {
          title: '员工管理'
        }
      }
    ]
  },
  {
    path: "/basic",
    name: "basic",
    component: layout,
    meta: {
      title: '基本资料', icon: 'icon-shichanghuodong'
    },
    children: [
      {
        path: "/storemanage",
        name: "storemanage",
        component: () => import("@/views/store/index"),
        meta: {
          title: '仓库管理'
        }
      },
      {
        path: "/supplier",
        name: "supplier",
        component: () => import("@/views/supplier/index"),
        meta: {
          title: '供应商管理'
        }
      },
      {
        path: "/productcategory",
        name: "productcategory",
        component: () => import("@/views/info/productcategory"),
        meta: {
          title: '装备类别'
        }
      },
      {
        path: "/productlist",
        name: "productlist",
        component: () => import("@/views/info/index"),
        meta: {
          title: '装备管理'
        }
      },
      
    ]
  },
  {
    path: "/carmanage",
    name: "carmanage",
    component: layout,
    meta: {
      title: '车辆管理', icon: 'icon-iconbaoming'
    },
    children: [
      {
        path: "/carcategory",
        name: "carcategory",
        component: () => import("@/views/carmanage/carcategory"),
        meta: {
          title: '车辆类别'
        }
      },
      {
        path: '/carindex',
        name: 'carindex',
        component: () => import("@/views/carmanage/index"),
        meta: {
          title: '车辆管理'
        }
      },
      {
        path: '/carprods',
        name: 'carprods',
        component: () => import("@/views/carmanage/carprods"),
        hidden: true,
        meta: {
          title: '车辆装备管理'
        }
      }
    ]
  },
  {
    path: '/warehouse',
    name: 'warehouse',
    component: layout,
    meta: {
      title: '仓库作业', icon: 'icon-iconbaoming'
    },
    children: [
      {
        path: '/putstore',
        name: 'putstore',
        component: () => import('@/views/putstore/putstore'),
        meta: { title: '入库管理'},
      },
      {
        path: '/addPutOrder',
        name: 'addPutOrder',
        component: () => import('@/views/putstore/addputorder'),
        hidden: true,
        meta: { title: '新增入库单'},
      },
      {
        path: '/outstore',
        name: 'outstore',
        component: () => import('@/views/outstore/outstore'),
        meta: { title: '出库管理'}
      },
      {
        path: '/addOutOrder',
        name: 'addOutOrder',
        component: () => import('@/views/outstore/addoutorder'),
        hidden: true,
        meta: { title: '新增出库单'}
      },
      {
        path: '/allot',
        name: 'allot',
        component: () => import('@/views/allot/allot'),
        meta: { title: '调拨管理'}
      },
      {
        path: '/addallot',
        name: 'addallot',
        component: () => import('@/views/allot/addallot'),
        hidden: true,
        meta: { title: '新增调拨单'}
      },
      {
        path: '/inventory',
        name: 'inventory',
        component: () => import('@/views/inventory/inventory'),
        meta: { title: '盘点管理'}
      },
      {
        path: '/addinventory',
        name: 'addinventory',
        component: () => import('@/views/inventory/addinventory'),
        hidden: true,
        meta: { title: '新增盘点单'}
      },
      {
        path: '/destory',
        name: 'destory',
        component: () => import('@/views/destory/destory'),
        meta: { title: '报废管理'}
      },
      {
        path: '/adddestory',
        name: 'adddestory',
        component: () => import('@/views/destory/adddestory'),
        hidden: true,
        meta: { title: '新增报废单'}
      },
    ]
  },
  {
    path: "/stock",
    name: "stock",
    component: layout,
    meta: {
      title: '库存管理', icon: 'icon-shichanghuodong'
    },
    children: [
      {
        path: "/stockmanage",
        name: "stockmanage",
        component: () => import("@/views/stock/index"),
        meta: {
          title: '库存清单'
        }
      },
      {
        path: "/datewarning",
        name: "datewarning",
        component: () => import("@/views/stock/datewarning"),
        hidden: true,
        meta: {
          title: '到期预警'
        }
      },
      {
        path: "/stockdetail",
        name: "stockdetail",
        component: () => import("@/views/stock/stockdetail"),
        meta: {
          title: '标签管理'
        }
      },
      // {
      //   path: "/standbook",
      //   name: "standbook",
      //   component: () => import("@/views/stock/standbook"),
      //   meta: {
      //     title: '库存日志'
      //   }
      // },
    ]
  },
  // {
  //   path: '/test',
  //   component: () => import('@/views/test/excel'),
  //   hidden: true,
  // }
];

const router = new VueRouter({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({ y: 0 }),
  routes
});

export default router;
